package kr.couponplay.android.activity.deal.list;

import kr.couponplay.android.domain.deal.DealListResult;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class DealListViewPagerAdapter extends FragmentStatePagerAdapter {
	private DealListFragmentFactory fragmentFactory;
	
	public DealListViewPagerAdapter(FragmentManager fragmentManager, DealListResult dealListBox) {
		super(fragmentManager);
		this.fragmentFactory = new DealListFragmentFactory(dealListBox);
    }
	
	@Override
	public Fragment getItem(int position) {
		return fragmentFactory.get(position);
    }
	
	@Override
	public int getItemPosition(Object item) {
		DealListFragment fragment = (DealListFragment)item;
        return fragment.getPosition();
    }
	
	@Override
	public int getCount() {
		return fragmentFactory.getCount();
	}
}
